package org.jeecg.modules.demo.document.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.demo.certificate.Utils.JZUtils;
import org.jeecg.modules.demo.certificate.entity.SchoolCertificates;
import org.jeecg.modules.demo.certificate.mapper.SchoolCertificatesMapper;
import org.jeecg.modules.demo.certificate.service.ISchoolCertificatesService;
import org.jeecg.modules.demo.document.entity.Plandto;
import org.jeecg.modules.demo.document.service.FilesService;
import org.jeecg.modules.demo.document.service.IPlandtoService;
import org.jeecg.modules.demo.document.utils.FilesDO;
import org.jeecg.modules.demo.document.utils.HttpClientUtil;
import org.jeecg.modules.demo.document.utils.PDFFileUtils;
import org.jeecg.modules.demo.document.utils.PdfFileUtil;
import org.jeecg.modules.message.websocket.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @Description: 任务信息
 * @Author: jeecg-boot
 * @Date:   2022-11-27
 * @Version: V1.0
 */
@Api(tags="任务信息")
@RestController
@RequestMapping("/document/plandto")
@Slf4j
public class PlandtoController extends JeecgController<Plandto, IPlandtoService> {
	@Autowired
	private IPlandtoService plandtoService;

	 @Autowired
	 private ISchoolCertificatesService schoolCertificatesService;
	 @Autowired
	 private SchoolCertificatesMapper schoolCertificatesMapper;
	 private String taskName;
	 private String type="DOCUMENT";
	 private String token;
	 private String userId;
	private int genBatch;
	private int genBatch2;
	private int flag=0;
	 private String  docId;
	 private String[] list;
	 private String[] download;
	 @Autowired
	 private FilesService filesService;
	@Resource
	private WebSocket webSocket;
	 /**
      * 分页列表查询
      *
      * @param plandto
      * @param pageNo
      * @param pageSize
      * @param req
      * @return
      */
	//@AutoLog(value = "任务信息-分页列表查询")
	@ApiOperation(value="任务信息-分页列表查询", notes="任务信息-分页列表查询")
	@GetMapping(value = "/list")
	public Result<IPage<Plandto>> queryPageList(Plandto plandto,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		QueryWrapper<Plandto> queryWrapper = QueryGenerator.initQueryWrapper(plandto, req.getParameterMap());
		Page<Plandto> page = new Page<Plandto>(pageNo, pageSize);
		IPage<Plandto> pageList = plandtoService.page(page, queryWrapper);
		return Result.OK(pageList);
	}
	
	/**
	 *   添加
	 *
	 * @param plandto
	 * @return
	 */
	@AutoLog(value = "任务信息-添加")
	@ApiOperation(value="任务信息-添加", notes="任务信息-添加")
	//@RequiresPermissions("org.jeecg.modules.demo:plandto:add")
	@PostMapping(value = "/add")
	public Result<String> add(@RequestBody Plandto plandto) {
		plandtoService.save(plandto);
		WebSocket webSocket;
		return Result.OK("添加成功！");

	}
	
	/**
	 *  编辑
	 *
	 * @param plandto
	 * @return
	 */
	@AutoLog(value = "任务信息-编辑")
	@ApiOperation(value="任务信息-编辑", notes="任务信息-编辑")
	//@RequiresPermissions("org.jeecg.modules.demo:plandto:edit")
	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
	public Result<String> edit(@RequestBody Plandto plandto) {
		plandtoService.updateById(plandto);
		return Result.OK("编辑成功!");
	}
	
	/**
	 *   通过id删除
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "任务信息-通过id删除")
	@ApiOperation(value="任务信息-通过id删除", notes="任务信息-通过id删除")
	//@RequiresPermissions("org.jeecg.modules.demo:plandto:delete")
	@DeleteMapping(value = "/delete")
	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
		plandtoService.removeById(id);
		return Result.OK("删除成功!");
	}
	
	/**
	 *  批量删除
	 *
	 * @param ids
	 * @return
	 */
	@AutoLog(value = "任务信息-批量删除")
	@ApiOperation(value="任务信息-批量删除", notes="任务信息-批量删除")
	//@RequiresPermissions("org.jeecg.modules.demo:plandto:deleteBatch")
	@DeleteMapping(value = "/deleteBatch")
	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
		this.plandtoService.removeByIds(Arrays.asList(ids.split(",")));
		return Result.OK("批量删除成功!");
	}
	
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	//@AutoLog(value = "任务信息-通过id查询")
	@ApiOperation(value="任务信息-通过id查询", notes="任务信息-通过id查询")
	@GetMapping(value = "/queryById")
	public Result<Plandto> queryById(@RequestParam(name="id",required=true) String id) {
		Plandto plandto = plandtoService.getById(id);
		if(plandto==null) {
			return Result.error("未找到对应数据");
		}
		return Result.OK(plandto);
	}

    /**
    * 导出excel
    *
    * @param request
    * @param plandto
    */
    //@RequiresPermissions("org.jeecg.modules.demo:plandto:exportXls")
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, Plandto plandto) {
        return super.exportXls(request, plandto, Plandto.class, "任务信息");
    }

    /**
      * 通过excel导入数据
    *
    * @param request
    * @param response
    * @return
    */
    //@RequiresPermissions("plandto:importExcel")
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, Plandto.class);
    }

	 /**
	  * 判断文件是否存在
	  */
	 @PostMapping("/existsFiles")

	 public Result existsFiles(@RequestBody Map<String, String> banner) throws IOException {
		 //获取文件路径
		 String ids= banner.get("ids");
		 list=ids.split(",");
		 for(int i=0;i<list.length;i++) {
			 String id = list[i];
			 SchoolCertificates schoolCertificates = schoolCertificatesService.getById(id);
			 File file = new File("/opt/upFiles/"+schoolCertificates.getDownload());
			 if (!file.exists()) {
				 return Result.error(schoolCertificates.getDownload());
			 }
		 }
		 return Result.OK();
	 }

	 /**
	  *  批量下载
	  *
	  * @param banner
	  * @return
	  */
	 @AutoLog(value = "校级证书-批量下载")
	 @ApiOperation(value="校级证书-批量下载", notes="校级证书-批量下载")
	 //@RequiresPermissions("org.jeecg.modules.demo:school_certificates:deleteBatch")
	 @PostMapping(value = "/downloadBatch")
	 public Result<List<String>> downloadBatch(@RequestBody Map<String, String> banner) {
		 String ids= banner.get("ids");
		 download=ids.split(",");
		 return Result.ok();
	 }


	 /**
	  * 批量下载附件
	  */
	 @GetMapping("/batchDownloadFiles")
	 @ResponseBody
	 public Result batchDownloadFiles( HttpServletResponse response) throws IOException {
		 //获取文件路径

		 List<FilesDO> f = new ArrayList<>();
		 String filename=null;
		 for(int i=0;i<download.length;i++) {
			 String id = download[i];
			 SchoolCertificates schoolCertificates = schoolCertificatesService.getById(id);
			 filename=schoolCertificates.getCertificatesName();
			 FilesDO filesDO=new FilesDO();
			 filesDO.setFilename(schoolCertificates.getDownload());
			 filesDO.setFilepath("/opt/upFiles/"+schoolCertificates.getDownload());
			 f.add(filesDO);
		 }

		 if (f.isEmpty()){
			 return Result.error("Target File Not Exist");
		 }
		 File tempFile = File.createTempFile("tempFile", "zip");

		 tempFile = filesService.putBatchFilesInZip(f, tempFile);
		 try (OutputStream os = response.getOutputStream();
			  FileInputStream fis = new FileInputStream(tempFile)) {
//			 response.setHeader("content-type", "application/octet-stream");
			 response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename+"-附件.zip", "UTF-8"));
			 int len = 0;
			 byte[] bt = new byte[5 * 1024];
			 while ((len = fis.read(bt)) != -1) {
				 os.write(bt, 0, len);
			 }
		 } catch (Exception e) {
			 e.printStackTrace();
			 throw new RuntimeException();
		 } finally {
			 tempFile.deleteOnExit();
		 }

		 return Result.ok();
	 }

	 @ApiOperation(value="校级证书-通过id生成", notes="校级证书-通过id生成")
	 @GetMapping(value = "/genById")
	 public Result<SchoolCertificates> certificateGen(@RequestParam(name="id",required=true) String id, int type, String endTime,String userId) {
		 genBatch2=0;
		 this.userId=userId;
		 list=id.split(",");
		 SchoolCertificates schoolCertificates = schoolCertificatesService.getById(id);
//		 this.id=id;
		 if (schoolCertificates == null) {
			 return Result.error("未找到对应数据");
		 }
		 taskName=schoolCertificates.getName()+"-荣誉证书";
		 //暂时这样写，证书模板得修改
		 String year = schoolCertificates.getYear();
		 String[] years = year.split("-");
		 String newPDFPath;
		 String tmp_time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
		 //切分年月日
		 String[] tmp_times = tmp_time.split("-");
		 String time = tmp_times[0] + "年" + tmp_times[1] + "月" + tmp_times[2] + "日";
		 try {
			 JZUtils jzUtils=new JZUtils();
			 newPDFPath=jzUtils.ThreeGoodStudent2(schoolCertificates.getName(),schoolCertificates.getCertificatesName(),schoolCertificates.getCertificatesId(),time,"经武汉理工大学证书数字化管理平台验证，该证书内容属实。",id);
			 schoolCertificates.setDownload(newPDFPath);
			 schoolCertificatesService.updateById(schoolCertificates);
		 }
		 catch (Exception e){
			 return Result.error(e.getMessage());
		 }
		 try {
			 byte[] fileBase64Str=PDFFileUtils.PDFToBase64("/opt/upFiles/"+newPDFPath);

			 String body= JZUtils.postJson("http://esign.whut.edu.cn/ecapi/cus/assemble/openapi/v1/senddoc/sendB2BExample",this.token,fileBase64Str,newPDFPath,endTime,schoolCertificates.getName()+"-荣誉证书");
			 String data = HttpClientUtil.getString(body, "data");
			 log.info(body);
//			 this.taskrelid=HttpClientUtil.getString(data, "sendReqId");
			 String exampleDtos=HttpClientUtil.getString(data, "exampleDtos").replace("[","").replace("]","");
//			 this.id=HttpClientUtil.getString(exampleDtos, "planId");
//			 this.docrelid=HttpClientUtil.getString(exampleDtos, "relDocId");
			 this.docId=HttpClientUtil.getString(exampleDtos, "docId");
		 } catch (IOException e) {
			 e.printStackTrace();
		 }
		 return Result.OK(newPDFPath);
	 }
	 /**
	  *  批量生成
	  *
	  * @param banner
	  * @return
	  */
	 @AutoLog(value = "校级证书-批量生成")
	 @ApiOperation(value="校级证书-批量生成", notes="校级证书-批量生成")
	 //@RequiresPermissions("org.jeecg.modules.demo:school_certificates:deleteBatch")
	 @PostMapping(value = "/genBatch")
	 public synchronized Result<List<String>> genBatch(@RequestBody Map<String, String> banner) {
		 String ids= banner.get("ids");

		 String endTime=  banner.get("endTime");
		 list=ids.split(",");
		 genBatch=0;

		 List<String> list1=new ArrayList<>();
		 int le=0;
		 for(genBatch2=0;genBatch2<list.length;genBatch2++){

			 String id =list[genBatch2];
			 SchoolCertificates schoolCertificates = schoolCertificatesService.getById(id);
			 if (schoolCertificates == null) {
				 return Result.error("未找到对应数据");

			 }

			 //暂时这样写，证书模板得修改
			 String year = schoolCertificates.getYear();
			 String[] years = year.split("-");
			 String newPDFPath = null;
			 String tmp_time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
			 //切分年月日
			 String[] tmp_times = tmp_time.split("-");
			 String time = tmp_times[0] + "年" + tmp_times[1] + "月" + tmp_times[2] + "日";
			 try {
				 JZUtils jzUtils=new JZUtils();
				 //发送完后锁住



//				 Thread.sleep(800);//单位：毫秒
				 newPDFPath=jzUtils.ThreeGoodStudent2(schoolCertificates.getName(),schoolCertificates.getCertificatesName(),schoolCertificates.getCertificatesId(),time,"经武汉理工大学证书数字化管理平台验证，该证书内容属实。",id);
				 schoolCertificates.setDownload(newPDFPath);
				 schoolCertificatesService.updateById(schoolCertificates);
				 list1.add(newPDFPath);

			 }

			 catch (Exception e){
				 return Result.error(e.getMessage());

			 }
//			 log.info(String.valueOf(list));

			 try {
				 byte[] fileBase64Str=PDFFileUtils.PDFToBase64("/opt/upFiles/"+newPDFPath);
//				 Thread.sleep(800);//单位：毫秒
				 taskName=schoolCertificates.getName()+"-荣誉证书";
				 String body= JZUtils.postJson("http://esign.whut.edu.cn/ecapi/cus/assemble/openapi/v1/senddoc/sendB2BExample",this.token,fileBase64Str,newPDFPath,endTime,schoolCertificates.getName()+"-荣誉证书");
				 String data = HttpClientUtil.getString(body, "data");
				 String status = HttpClientUtil.getString(body, "status");
				 log.info(body);
				 if(status.equals("200")){
					 String exampleDtos=HttpClientUtil.getString(data, "exampleDtos").replace("[","").replace("]","");
//
					 this.docId=HttpClientUtil.getString(exampleDtos, "docId");
				 }else {
					 genBatch2--;
					 //确保重传在20次以内
					 le++;
					 if(le>20){
						 break;
					 }
				 }

//

			 } catch (IOException e) {
				 e.printStackTrace();
			 }
//			 catch (InterruptedException e) {
//				 e.printStackTrace();
//			 }

//			 flag=0;
//			 while (flag==0){
			 try {
				 this.wait();
			 } catch (InterruptedException e) {
				 e.printStackTrace();
			 }
//			 }
		 }




		 return Result.OK(list1);
	 }
	 /**
	  *  批量生成
	  *
	  * @param schoolCertificates2
	  * @return
	  */
	 @AutoLog(value = "校级证书-批量生成")
	 @ApiOperation(value="校级证书-批量生成", notes="校级证书-批量生成")
	 //@RequiresPermissions("org.jeecg.modules.demo:school_certificates:deleteBatch")
	 @GetMapping(value = "/genBatch2")
	 public synchronized  void genBatch2(SchoolCertificates schoolCertificates2,HttpServletRequest req,String endTime,String userId) throws InterruptedException{
		 QueryWrapper<SchoolCertificates> queryWrapper = QueryGenerator.initQueryWrapper(schoolCertificates2, req.getParameterMap());
		 List<SchoolCertificates> schoolCertificatesList=schoolCertificatesMapper.selectList(queryWrapper);
		 list=new String[schoolCertificatesList.size()];
		 for(int j=0;j<schoolCertificatesList.size();j++){
			 list[j]= schoolCertificatesList.get(j).getId();
		 }

		 List<String> list1=new ArrayList<>();
		 int le=0;
		 for(genBatch2=0;genBatch2<list.length;genBatch2++){

			 String id =list[genBatch2];
			 SchoolCertificates schoolCertificates = schoolCertificatesService.getById(id);
			 if (schoolCertificates == null) {
//				 return Result.error("未找到对应数据");
				 //创建业务消息信息
				 JSONObject obj = new JSONObject();
				 obj.put("cmd", "user");//业务类型
				 obj.put("msgId","批量生成" );//消息id
				 obj.put("msgTxt","未找到对应数据");//消息内容
				 //单个用户发送 (userId为用户id)
				 webSocket.sendMessage(userId, obj.toJSONString());
			 }

			 //暂时这样写，证书模板得修改
			 String year = schoolCertificates.getYear();
			 String[] years = year.split("-");
			 String newPDFPath = null;
			 String tmp_time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
			 //切分年月日
			 String[] tmp_times = tmp_time.split("-");
			 String time = tmp_times[0] + "年" + tmp_times[1] + "月" + tmp_times[2] + "日";
			 try {
				 JZUtils jzUtils=new JZUtils();
				//发送完后锁住



//				 Thread.sleep(800);//单位：毫秒
				 newPDFPath=jzUtils.ThreeGoodStudent2(schoolCertificates.getName(),schoolCertificates.getCertificatesName(),schoolCertificates.getCertificatesId(),time,"经武汉理工大学证书数字化管理平台验证，该证书内容属实。",id);
				 schoolCertificates.setDownload(newPDFPath);
				 schoolCertificatesService.updateById(schoolCertificates);
				 list1.add(newPDFPath);

			 }

			 catch (Exception e){
//				 return Result.error(e.getMessage());
				 //创建业务消息信息
				 JSONObject obj = new JSONObject();
				 obj.put("cmd", "user");//业务类型
				 obj.put("msgId","批量生成" );//消息id
				 obj.put("msgTxt",e.getMessage());//消息内容
				 //单个用户发送 (userId为用户id)
				 webSocket.sendMessage(userId, obj.toJSONString());
			 }
//			 log.info(String.valueOf(list));

			 try {
				 byte[] fileBase64Str=PDFFileUtils.PDFToBase64("/opt/upFiles/"+newPDFPath);
				 Thread.sleep(800);//单位：毫秒
				 taskName=schoolCertificates.getName()+"-荣誉证书";
				 String body= JZUtils.postJson("http://esign.whut.edu.cn/ecapi/cus/assemble/openapi/v1/senddoc/sendB2BExample",this.token,fileBase64Str,newPDFPath,endTime,schoolCertificates.getName()+"-荣誉证书");
				 String data = HttpClientUtil.getString(body, "data");
				 String status = HttpClientUtil.getString(body, "status");
				 log.info(body);
				 if(status.equals("200")){
					 String exampleDtos=HttpClientUtil.getString(data, "exampleDtos").replace("[","").replace("]","");
//
					 this.docId=HttpClientUtil.getString(exampleDtos, "docId");
				 }else {
				 	genBatch2--;
				 	//确保重传在20次以内
				 	le++;
				 	if(le>20){
				 		break;
					}
				 }

//

			 } catch (IOException e) {
				 e.printStackTrace();
			 }
			 catch (InterruptedException e) {
				 e.printStackTrace();
			 }

//			 flag=0;
//			 while (flag==0){
				 try {
					 this.wait();
				 } catch (InterruptedException e) {
					 e.printStackTrace();
				 }
//			 }
		 }

		//创建业务消息信息
		 JSONObject obj = new JSONObject();
		 obj.put("cmd", "user");//业务类型
		 obj.put("msgId","批量生成" );//消息id
		 obj.put("msgTxt","生成成功");//消息内容
		//单个用户发送 (userId为用户id)
		 webSocket.sendMessage(userId, obj.toJSONString());


//		 return Result.OK(list1);
	 }

	 @AutoLog(value = "合同回调")
	 @ApiOperation(value="合同回调", notes="合同回调")
	 //@RequiresPermissions("org.jeecg.modules.demo:plandto:add")
	 @PostMapping(value = "/callbacks")
	 public synchronized  Result<String> callbacks(@RequestBody Map<String,Object> plan) {
//	 		 genBatch2++;
			 String id = list[genBatch2];
			 SchoolCertificates schoolCertificates = schoolCertificatesService.getById(id);
			 log.info("plan" + plan);
//			 System.out.println(plan.get("planDTO").toString().split("taskName=")[1].split(",")[0]);

			 if(!taskName.equals(plan.get("planDTO").toString().split("taskName=")[1].split(",")[0])){
				 genBatch2--;
//				 flag=1;
				 this.notifyAll();
			 }
//			 if(taskName.equals(plan.get("planDTO"))){
//
//			 }

		 	else {

				 Map<String, String> params = new HashMap<>();
				 params.put("type", type);
				 params.put("docId", docId);

				 String filename = schoolCertificates.getAcademy() + schoolCertificates.getName() + schoolCertificates.getCertificatesId();


				 String newPDFPath = filename + ".pdf";
				 String url = "http://esign.whut.edu.cn/ecapi/interface/v1/download";
				 byte[] pdf = JZUtils.doGet(url, params, token);
				 String nfilename = schoolCertificates.getAcademy() + "_" + schoolCertificates.getName() + "_" + schoolCertificates.getCertificatesId() + ".pdf";
				 PDFFileUtils.BasetoPdffile(newPDFPath, pdf, nfilename);

				 File file2 = new File("/opt/upFiles/三好学生标兵11.21封面33.pdf");
				 File file1 = new File("/opt/upFiles/" + newPDFPath);
				 List<File> files = new ArrayList<File>();
				 files.add(file2);
				 files.add(file1);

				 try {
					 File f = PdfFileUtil.mulFile2One(files, "/opt/upFiles/" + nfilename);
					 schoolCertificates.setDownload(nfilename);
					 schoolCertificatesService.updateById(schoolCertificates);
				 } catch (IOException e) {
					 e.printStackTrace();
				 }
//				 flag=1;
				 this.notifyAll();
			 }
		//创建业务消息信息
		 if(genBatch2==0) {
			 JSONObject obj = new JSONObject();
			 obj.put("cmd", "user");//业务类型
			 obj.put("msgId", "单个生成");//消息id
			 obj.put("msgTxt", "盖章成功");//消息内容
			 //单个用户发送 (userId为用户id)
			 webSocket.sendMessage(userId, obj.toJSONString());
		 }

		 return Result.OK();
	 }

	 @AutoLog(value = "调用get接口")
	 @ApiOperation(value="调用get接口", notes="调用get接口")
	 //@RequiresPermissions("org.jeecg.modules.demo:plandto:add")
	 @PostMapping(value = "/invoke")
	 public Result<String> invoke(@RequestBody Map<String,Object> plan) {
		 String body=JZUtils.doGet("http://esign.whut.edu.cn/ecapi/token/sdkAccessToken",plan);
		 //获取data
		 String data = HttpClientUtil.getString(body, "data");
		 //获取token
		 this.token= HttpClientUtil.getString(data , "accessToken");
		 flag=0;
		 return Result.OK(this.token);

	 }

//	 @AutoLog(value = "调用post接口")
//	 @ApiOperation(value="调用post接口", notes="调用post接口")
//	 //@RequiresPermissions("org.jeecg.modules.demo:plandto:add")
//	 @PostMapping(value = "/invokePost")
//	 public Result<String> invokePost(@RequestBody Map<String,Object> params) {
//		 try {
////			 System.out.println((String) params.get("exampleInfos"));
////			 PDFFileUtils.BasetoPdffile("/opt/upFiles/123.pdf", (String) params.get("fileInfos"));
//
////			 System.out.println("params"+params);
////
////			 String body= HttpClientUtil.getInstance().postJson("http://218.197.103.164/ecapi/cus/assemble/openapi/v1/senddoc/sendB2BExample",this.token,jsonStr);
//			 String fileBase64Str
//			 String docName
//			 String body= JZUtils.postJson("http://218.197.103.164/ecapi/cus/assemble/openapi/v1/senddoc/sendB2BExample",this.token,params);
//			 String data = HttpClientUtil.getString(body, "data");
//			 System.out.println(body);
////			 this.taskrelid=HttpClientUtil.getString(data, "sendReqId");
//			 String exampleDtos=HttpClientUtil.getString(data, "exampleDtos").replace("[","").replace("]","");
////			 this.id=HttpClientUtil.getString(exampleDtos, "planId");
////			 this.docrelid=HttpClientUtil.getString(exampleDtos, "relDocId");
//			 this.docId=HttpClientUtil.getString(exampleDtos, "docId");
////			 System.out.println(exampleDtos);
////			 System.out.println(docrelid);
//		 } catch (IOException e) {
//			 e.printStackTrace();
//		 }
//		 return Result.OK();
//	 }

}
